package com.zhudeshuai.zhudemolist.activity;

import android.graphics.Color;
import android.os.Bundle;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.widget.TextView;

import com.zhudeshuai.zhudemolist.R;
import com.zhudeshuai.zhudemolist.base.BaseActivity;

public class SpannableStringDemo extends BaseActivity {

	private TextView tv;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_spannable_string_demo);
		tv = (TextView) findViewById(R.id.tv);




		String target = "老板的车源";
		SpannableString spannableString = new SpannableString(target);
		spannableString.setSpan(new ForegroundColorSpan(Color.RED),0,2, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);

		tv.setText(spannableString, TextView.BufferType.SPANNABLE);
	}
}
